<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>隐藏</title>
    <style>
        #d1 {
            width: 400px;
            height: 400px;
            background-color: skyblue;
            /*这样隐藏d2会代替d1的位置*/
            /* display: none; */

            /*这样隐藏就不会被代替，占位还在*/
            visibility: hidden;
        }

        #d2 {
            width: 400px;
            height: 400px;
            background-color: orange;
        }
    </style>
</head>
<body>
<div id="d1">
    1
</div>
<div id="d2">
    2
</div>
<hr>
</body>
</html>